(function(){
	//Private variables
	var socket,
		connectionURL = 'http://localhost:20000'; //Default value

	//Insert socket.io script in page
	var headID = document.getElementsByTagName("head")[0];         

	//Inserto la librería Socket.io
	var socketIo = document.createElement('script');
	socketIo.type = 'text/javascript';
	socketIo.onload=scriptLoaded;
	socketIo.src = connectionURL + '/socket.io/socket.io.js';
	headID.appendChild(socketIo);

	function scriptLoaded () {
		socket = io.connect(connectionURL);
	}

	//Tickmap
	var wikimapiaCategories = {
		//Connection URL Setter
		setConnectionURL: function(url) {
			connectionURL = url;
		},

		getAll: function(language, callback) {
			socket.emit('getAllWikimapiaCategoriesLanguage', language, callback);
		}

	};
	if(!window.wikimapiaCategories){window.wikimapiaCategories=wikimapiaCategories;}//We create a shortcut for our framework
})();